﻿$(document).ready(function () {
    $("#chkAll").click(function () {
        var arrChkID = $(".chkID");
        for (var i = 0; i < arrChkID.length; i++) {
            arrChkID.eq(i).attr("checked", $("#chkAll").attr("checked"));
        }
    });
    $(".chkID").click(function () {
        var arrChkID = $(".chkID");
        var count = 0;
        for (var i = 0; i < arrChkID.length; i++) {
            if (arrChkID.eq(i).attr("checked")) count++;
        }
        if (count == arrChkID.length) {
            $("#chkAll").attr("checked", "checked");
        } else {
            $("#chkAll").attr("checked", "");
        }
    });
});